﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Security;

namespace Inovout.Cloud.Identity.QuickStarts.Controllers
{
    [Authorize]
    public class MeController : Controller
    {
        public  ActionResult Index()
        {
            var membership = Newtonsoft.Json.JsonConvert.DeserializeObject<Dictionary<string, string>>(GetUserData());
            return View(membership);

        }

        public string GetUserData()
        {
            FormsAuthenticationTicket formsAuthenticationTicket =
                FormsAuthentication.Decrypt(HttpContext.Request.Cookies.Get(FormsAuthentication.FormsCookieName).Value);
            return formsAuthenticationTicket.UserData;
        }

    }
}